﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;
using UniCT.LinkShareWpf.Interface;
using UniCT.LinkShareWpf.Model;
using System.Collections.ObjectModel;

namespace LinkShareWpf.Converters
{
    public class CastToStringConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string cast = string.Empty;
            if ((value as ObservableCollection<string>).Count > 0)
            {
                int i;
                for (i = 0; i < (value as ObservableCollection<string>).Count - 1; i++)
                    cast += (value as ObservableCollection<string>).ElementAt(i) + ", ";
                cast += (value as ObservableCollection<string>).ElementAt(i);
            }
            return cast;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
